package com.googlemail.drewwilliams1982;

import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.os.Debug;

public class CheeseWidget extends AppWidgetProvider 
{
	@Override
	public void onReceive(Context context, Intent intent)
	{
		Debug.waitForDebugger();
		if(intent.getAction() == null)
		{
			Intent myIntent = new Intent(context, ToggleService.class);
			myIntent.putExtra("ToggleSound", true);
			context.startService(myIntent);

		}
		else
		{
			super.onReceive(context, intent);
		}
	}
	
	@Override
	public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
	{
		Debug.waitForDebugger();
		Intent myIntent = new Intent(context, ToggleService.class);
		myIntent.putExtra("ToggleSound", false);
		context.startService(myIntent); 
	}
}
